package com.itheima.code.service.impl;

import com.itheima.code.dao.OrderMapper;
import com.itheima.code.dto.OrderDTO;
import com.itheima.code.service.IOrderService;
import com.itheima.code.strategy.AbstractHandler;
import com.itheima.code.strategy.HandlerContext1;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class OrderServiceImpl implements IOrderService {

    @Autowired
    private HandlerContext1 handlerContext;

    @Autowired
    private OrderMapper orderMapper;

    @Override
    public String handle(OrderDTO dto) {
        AbstractHandler instance = handlerContext.getInstance(dto.getType());

        return instance.handle(dto);
    }
}
